package acm;


import java.util.Arrays;
import java.util.Scanner;

public class Anagrams问题 {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String str=in.next();
        String strs=in.next();
        String stra=str.toUpperCase();
        String strsa=strs.toUpperCase();
        char[] word = stra.toCharArray();
        char[] words = strsa.toCharArray();
        char max=0,maxs=0;
        int j=0,xb=0,xbs=0;
        if (word.length!=words.length){
            System.out.print("N");
        }
        else {
            Arrays.sort(word);
            Arrays.sort(words);
            String rest1 = new String(word);
            String rest2 = new String(words);
            if (rest1.equals(rest2)) {
                System.out.print("Y");
            } else {
                System.out.print("N");
            }
        }
    }
}
